Repository navigation
feat(cli): decode firmware_version as the device release version - #204
Open
calvinleng-science wants to merge 1 commit into
Open
calvinleng-science wants to merge 1 commit into
calvinleng-science wants to merge 1 commit into
Conversation
SciFi firmware now packs its release version into DeviceInfo.firmware_version (device byte 1/2, then major/minor/patch). synapsectl info shows it as e.g. 2.5.0; older firmware that sent a git hash still shows that hash in hex.
There was a problem hiding this comment.
🟡 Changes recommended
The hex fallback drops leading zeroes from legacy eight-character commit hashes, producing incorrect prefixes that cannot reliably identify firmware in Git.
1 open issue
What changed in this PR
Updates synapsectl info to display packed firmware versions as readable device release versions, such as 2.5.0.
Changes:
- Adds a firmware-version decoder for SciFi1 and SciFi2, with a hexadecimal fallback for legacy values.
- Uses the decoder in the CLI while preserving
Unknownfor missing values. - Adds unit tests for both device encodings and the legacy fallback.
| File | Description |
|---|---|
synapse/utils/version.py |
Adds firmware release decoding and legacy hexadecimal fallback. |
synapse/tests/utils/test_version.py |
Tests packed releases and a legacy hash. |
synapse/cli/device_info_display.py |
Displays the decoded firmware version in device summaries. |
Review effort: Balanced
| """ | ||
| # ponytail: an old git hash whose top byte happens to be 0x01/0x02 decodes wrongly; unavoidable without a proto change. | ||
| if (v >> 24) & 0xFF not in (1, 2): | ||
| return f"{v:x}" |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
synapsectl infodecodesfirmware_versioninto the device release version (e.g.Firmware Version: 2.5.0), using a newdecode_firmware_version()next todecode_synapse_version().DeviceInfo.firmware_version(uint32) now carries the device release version from headstage'sops/release/manifest.toml, packed as0xDDMMmmpp:1= SciFi1,2= SciFi2e.g. SciFi2 2.5.0 →
0x02020500, SciFi1 1.10.0 →0x01010A00.Backwards compatible: older firmware put its git hash in this field. Anything without a device byte of 1 or 2 is shown as that hash in hex, as before. I checked the release merge commits on headstage
main(where release builds are made, as 8-char hashes): none starts with01/02, so no released firmware gets misread. Only about 1 in 128 ad-hoc dev builds could.Testing
synapse/tests/utils/test_version.pycovers 2.5.0, 1.10.0 and the git-hash fallback.0x2020500→2.5.0.Related PRs
dev)